home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / standard / alloca.z / alloca
Encoding:
Text File  |  1998-10-30  |  2.6 KB  |  67 lines

  1.  
  2.  
  3.  
  4. AAAALLLLLLLLOOOOCCCCAAAA((((3333CCCC))))                                                          AAAALLLLLLLLOOOOCCCCAAAA((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      alloca - allocate dynamic space
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<aaaallllllllooooccccaaaa....hhhh>>>>
  13.  
  14.      vvvvooooiiiidddd ****aaaallllllllooooccccaaaa ((((uuuunnnnssssiiiiggggnnnneeeedddd ssssiiiizzzzeeee))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      _a_l_l_o_c_a returns a pointer to _s_i_z_e bytes of uninitialized local stack
  18.      space.  Since the space is allocated using a built-in compiler function,
  19.      the allocation is quite fast.  If zero is passed as _s_i_z_e, _a_l_l_o_c_a returns
  20.      a valid pointer (unlike some versions of _m_a_l_l_o_c, which consider a zero
  21.      size to be an error).
  22.  
  23.      The #_i_n_c_l_u_d_e <_a_l_l_o_c_a._h> is required.
  24.  
  25.      Space allocated when a function _f_o_o calls _a_l_l_o_c_a is freed automatically
  26.      when _f_o_o returns.
  27.  
  28.      It is an error to call _f_r_e_e with a pointer returned by _a_l_l_o_c_a.
  29.  
  30.      Not all environments have _a_l_l_o_c_a in their libraries, so code using it is
  31.      not necessarily portable.  Reasonably portable public domain versions of
  32.      this function are available from various sources on the Internet and the
  33.      World Wide Web.
  34.  
  35. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  36.      malloc(3), calloc(3), free(3), /usr/include/alloca.h
  37.  
  38. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  39.      In this implementation _a_l_l_o_c_a cannot fail (though if _s_i_z_e makes the
  40.      process too large IRIX may kill the process).  Since _a_l_l_o_c_a always
  41.      returns a valid pointer, no diagnostics are possible.  Portability may be
  42.      enhanced if the function calling _a_l_l_o_c_a tests for a return value of 0 and
  43.      handles 0 as an error.
  44.  
  45. CCCCAAAAVVVVEEEEAAAATTTTSSSS
  46.      Do not call _a_l_l_o_c_a as an argument to another function, as in
  47.      foo(alloca(20));.  _I_n_s_t_e_a_d _u_s_e, _f_o_r _e_x_a_m_p_l_e, _c_p = _a_l_l_o_c_a(_2_0); _f_o_o(_c_p);.
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.